package classes.form {
	import classes.Label;

	import flash.display.Sprite;

	/**
	 * @author dennis
	 */
	public class Input extends FormElement {

		private var Text : String;
		private var text : Label;

		public function Input(name : String) : void {
			super();
			this.Text = name;
			this.formName = name;
		}

		public function generate(skinObject : *) : void {
			var inputBox : Sprite = new Sprite();
			
			/*
			 * Label
			 */
			var label : Label = new Label(this.Text);
			label.generate(10, 0x000000, false, 200);
			this.addChild(label);
				
			/*
			 * Input
			 */
			if( skinObject ) {
				inputBox.addChild(skinObject);
			} else {
				var bg : Sprite = new Sprite();
				bg.graphics.beginFill(0xcdcdcd);
				bg.graphics.drawRect(0, 0, 10, 15);
				bg.graphics.endFill();
				bg.width = 100;
				bg.height = 15;
				inputBox.addChild(bg);
			}			
			
			this.text = new Label("");
			this.text.generate(10, 0x000000, true, 300, 33);
			this.text.y = 2;
			this.text.x = 2;
			inputBox.addChild(this.text);
			inputBox.x = this.SPACE_LABEL_FIELD;
			
			this.addChild(inputBox);
		}

		public function getValue() : String {
			trace("::" + this.text.getText());
			return this.text.getText(); 
		}
	}
}
